package Class.Advance.MethodReference;

import java.util.Arrays;

public class Example {
    public static void main(String[] args) {
        Integer[] arr1 = {3, 1, 5, 2, 4};
        Arrays.sort(arr1, (o1, o2) -> o2 - o1);
        for (int i = 0; i < arr1.length; i++) {
            System.out.print(arr1[i] + " ");
        }
        System.out.println();
        Integer[] arr2 = {3, 1, 5, 2, 4};
        Arrays.sort(arr2, Example::submit);
        for (int i = 0; i < arr2.length; i++) {
            System.out.print(arr2[i] + " ");
        }
    }

    public static int submit(int num1, int num2) {
        return num2 - num1;
    }
}
